import request from "@/utils/request";
import type {PageType} from "@/api/type";
import type {LostItems,ItemRequestSaveForm,FoundItems,LostFoundCategory} from "@/api/serve/lost/type";

enum API{
    LOST_ITEM = '/serve/lostItems',
    LOST_ITEM_PAGE = '/serve/lostItems/page',
    FOUND_ITEM = '/serve/foundItems',
    FOUND_ITEM_PAGE = '/serve/foundItems/page',
    ITEM_REQUEST = '/serve/lost-found/item-request',
    ITEM_REQUEST_PAGE = '/serve/lost-found/item-request/page',
    LOST_FOUND_CATEGORY = '/serve/lostFoundCategory',
    LOST_FOUND_CATEGORY_LIST = '/serve/lostFound/category/list',
}

export function reqGetLostItemPage(query: any){
    return request<PageType<LostItems>>({
        url: API.LOST_ITEM_PAGE,
        method: "get",
        params: query,
    });
}
export function reqGetLostItemById(lostItemId: string){
    return request<LostItems>({
        url: API.LOST_ITEM + '/' + lostItemId,
        method: "get",
    });
}
export function reqAddLostItem(data: LostItems){
    return request<LostItems>({
        url: API.LOST_ITEM,
        method: "post",
        data,
    });
}
export function reqUpdateLostItem(data: LostItems){
    return request<LostItems>({
        url: API.LOST_ITEM,
        method: "put",
        data,
    });
}
export function reqDeleteLostItem(lostItemId: string){
    return request<LostItems>({
        url: API.LOST_ITEM + '/' + lostItemId,
        method: "delete",
    });
}
export function reqGetFoundItemPage(query: any){
    return request<PageType<FoundItems>>({
        url: API.FOUND_ITEM_PAGE,
        method: "get",
        params: query,
    });
}
export function reqGetFoundItemById(foundItemId: string){
    return request<FoundItems>({
        url: API.FOUND_ITEM + '/' + foundItemId,
        method: "get",
    });
}
export function reqAddFoundItem(data: Object){
    return request({
        url: API.FOUND_ITEM,
        method: "post",
        data,
    });
}
export function reqUpdateFoundItem(data: object){
    return request({
        url: API.FOUND_ITEM,
        method: "put",
        data,
    });
}
export function reqDeleteFoundItem(foundItemId: string){
    return request({
        url: API.FOUND_ITEM + '/' + foundItemId,
        method: "delete",
    });
}
export function reqGetItemRequestPage(query: any){
    return request({
        url: API.ITEM_REQUEST_PAGE,
        method: "get",
        params: query,
    });
}
export function reqGetItemRequestById(claimId: string){
    return request({
        url: API.ITEM_REQUEST + '/' + claimId,
        method: "get",
    });
}
export function reqAddItemRequest(data: ItemRequestSaveForm){
    return request({
        url: API.ITEM_REQUEST,
        method: "post",
        data,
    });
}
export function reqUpdateItemRequest(data: ItemRequestSaveForm){
    return request({
        url: API.ITEM_REQUEST,
        method: "put",
        data,
    });
}
export function reqDeleteClaimRecord(claimId: string){
    return request({
        url: API.ITEM_REQUEST + '/' + claimId,
        method: "delete",
    });
}

export function reqGetLostFoundCategoryList(){
    return request<LostFoundCategory[]>({
        url: API.LOST_FOUND_CATEGORY_LIST,
        method: "get",
    });
}
